<style>
    .img-pic{ width:100% !important}
    .padding-small{color: #eb6876;cursor: pointer;}
    .select-ys{color: white;}
</style>
<script type="text/javascript">
    $(function(){
        //商品名称过长时的处理
        deal_words($('.ycyc a'));
        $('.layout .container .line ul>li').bind('click',function(){
            $(this).addClass('select-ys').siblings('li').removeClass('select-ys');
            $('.layout #main>div').hide().eq($(this).index()).show();
        });
    });
    //ajax加载更多内容
    function loadMore(obj){
        if($(obj).html()=='没有更多')return false;
        var group = $(obj).attr('group');
        var type =  $(obj).attr('type');
        var next_page =  parseInt($(obj).attr('next-page'));     //要请求的页面
        var param = 'promotions_group_id='+group+'&promotions_type_id='+type+'&curpage='+next_page;
        $(obj).html('正努力加载...');
        $.getJSON('?act=promotions&op=list',param,function(data){
            if(data.status==true){
                $(data.goods_all).each(function(i,item){
                    var str = '<div class="x6 margin-small-top ">'
                        +'<ul class="list-unstyle padding-small radius-big bg-white clearfix ">'
                        +'<li><a url="?act=goods&goods_id='+item.goods_id+'" onClick="pclicked(this);"><img class="img-responsive self-motion" '
                        + 'src="'+item.goods_image+'"></a></li>'
                        +'<li class="ycyc"><a url="?act=goods&goods_id='+item.goods_id+'" onClick="pclicked(this);">'+item.goods_name+'</a></li><li class="text-small zt-color">美财价 ：';
                    if(data.is_login==1){
                        str+= item.goods_store_price;
                    }else{
                        str+= '<a url="index.php?act=login" onClick="pclicked(this);">请登录</a>';
                    }
                    str+= '</li><li class="button-small button border-red-light radius-rounded float-right"><a '
                    + 'href="?act=goods&goods_id='+item.goods_id+'">立即抢购</a></li></ul></div>';
                    $('#wrap-'+group).append(str);
                })
                $(obj).attr('next-page',next_page+1);       //变更加载的下一页数字
                $(obj).html('加载更多');
            }else{
                alert('没有更多');
                $(obj).html('没有更多');
            }
        });
    }
</script>

<header class="layout head padding-small">
    <a onclick="back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white"><?php echo $output['html_title']?></h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>

<div class="layout"><img class="img-pic" src="<?php echo TEMPLATES_PATH; ?>/promotions/images/b_01.jpg"></div>
<div class="layout">
    <div class="line-small ">
        <?php if(isset($output['one_adv'])){ $salon = parse_url($output['one_adv']['info']['adv_pic_url']); ?>
        <div class="x6 margin-small-top"> <a url="<?php echo ltrim($salon['path'],'/') . '?' . $salon['query']; ?>" onClick="pclicked(this);"><img class="img-pic" src="/upload/adv/<?php echo $output['one_adv']['info']['adv_pic']?>"></a></div>
        <?php }?>
        <?php if(isset($output['two_adv'])){ $cosme =parse_url($output['two_adv']['info']['adv_pic_url']); ?>
        <div class="x6 margin-small-top"><a url="<?php echo ltrim($cosme['path'],'/') . '?' . $cosme['query'];?>" onClick="pclicked(this);"><img class="img-pic" src="/upload/adv/<?php echo $output['two_adv']['info']['adv_pic']?>"></a></div>
        <?php }?>
    </div>
</div>

<!--类别导航S-->
<div class="layout">
    <div class="container">
        <div class="line margin-top">
            <ul class="x12 text-center list-unstyle custom-b">
                <li id="single" class="x4 left-yj padding-small select-ys"><?php echo $output['promotions_group'][PROMOTIONS_NEW]?></li>

                <li id="twin" class="x4 zy-border padding-small badge-corner"><?php echo $output['promotions_group'][PROMOTIONS_BEST]?></li>

                <li id="three" class="x4 right-yj padding-small"><?php echo $output['promotions_group'][PROMOTIONS_SPECIAL]?></li>
            </ul>
        </div>
    </div>
</div>
<!--类别导航E-->

<div class="layout padding-small-top padding-small-bottom" >
    <div id="main" class="container">
        <!--新品推荐S-->
        <div id="single_con" class="twin_con">
            <?php if(is_array($output['promotions'][PROMOTIONS_NEW])&&count($output['promotions'][PROMOTIONS_NEW])>0){?>
            <div class="line-small" id="wrap-<?php echo PROMOTIONS_NEW;?>">
                <?php foreach($output['promotions'][PROMOTIONS_NEW] as $k=>$v){?>
                <div class="x6 margin-small-top ">
                    <ul class="list-unstyle padding-small radius-big bg-white clearfix ">
                        <li><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><img class="img-responsive self-motion" src="<?php echo thumb($v,'small');?>" onload="imgheqw(this)"></a></li>
                        <li class="ycyc"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><?php echo $v['goods_name'] ?></a></li>
                        <li class="text-small zt-color">美财价 ：<?php if ($_SESSION['is_login'] == '1') {
                            echo '¥'. $v['goods_store_price'];
                        } else {
                            echo '<a url="index.php?act=login" onClick="pclicked(this);">请登录</a>';
                        } ?></li>
                        <li class="button-small button border-red-light radius-rounded float-right"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);">立即抢购</a></li>
                    </ul>
                </div>
                <?php }?>
            </div>
            <div class="text-center bg-white margin-top padding-small" onclick="loadMore(this)" group="<?php echo PROMOTIONS_NEW;?>" type="<?php echo $_GET['promotions_type_id'];?>" next-page="2">加载更多</div>
         <?php }else{?>
            <ul> <li class="noTxt">
                    <div class="text-center text-gray padding-large">
                        <i class="icon-meh-o"></i>
                        <p>暂无相关的数据记录。</p>
                    </div>
                </li></ul>
        <?php }?></div>

        <!--畅销爆款S-->
        <div id="twin_con" class="twin_con" style="display:none;">
            <?php if(is_array($output['promotions'][PROMOTIONS_BEST])&&count($output['promotions'][PROMOTIONS_BEST])>0){?>
            <div class="line-small" id="wrap-<?php echo PROMOTIONS_BEST;?>">
                <?php  foreach($output['promotions'][PROMOTIONS_BEST] as $k=>$v) {?>
                <div class="x6 margin-small-top ">
                    <ul class="list-unstyle padding-small radius-big bg-white clearfix ">
                        <li><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><img class="img-responsive self-motion" src="<?php echo thumb($v,'small');?>"></a></li>
                        <li class="ycyc"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><?php echo $v['goods_name'] ?></a></li>
                        <li class="text-small zt-color">畅销价 ：<?php if ($_SESSION['is_login'] == '1') {
                                echo  '¥'. $v['goods_store_price'];
                            } else {
                                echo '<a url="index.php?act=login" onClick="pclicked(this);">请登录</a>';
                            }?></li>
                        <li class="button-small button border-red-light radius-rounded float-right"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);">立即抢购</a></li>
                    </ul>
                </div>
                <?php }?></div>
                <div class="text-center bg-white margin-top padding-small" onclick="loadMore(this)" group="<?php echo PROMOTIONS_BEST;?>" type="<?php echo $_GET['promotions_type_id'];?>" next-page="2">加载更多</div>
                <?php }else{?>
                    <ul> <li class="noTxt">
                            <div class="text-center text-gray padding-large">
                                <i class="icon-meh-o"></i>
                                <p>暂无相关的数据记录。</p>
                            </div>
                        </li></ul>
                <?php }?></div>

        <!--特价推荐S-->
        <div id="three_con" class="twin_con" style="display:none;">
            <?php if(is_array($output['promotions'][PROMOTIONS_SPECIAL])&&count($output['promotions'][PROMOTIONS_SPECIAL])>0){?>
            <div class="line-small" id="wrap-<?php echo PROMOTIONS_SPECIAL;?>">
                <?php foreach($output['promotions'][3] as $k=>$v){?>
                <div class="x6 margin-small-top ">
                    <ul class="list-unstyle padding-small radius-big bg-white clearfix ">
                        <li><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><img class="img-responsive self-motion" src="<?php echo thumb($v,'small');?>"></a></li>
                        <li class="ycyc"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);"><?php echo $v['goods_name'] ?></a></li>
                        <li class="text-small zt-color">美财价 ：<?php if ($_SESSION['is_login'] == '1') {
                                if($v['xianshi_flag']==1&&$v['xianshi_discount']!='0.00'){
                                    echo ncPriceFormat($v['goods_store_price']*($v['xianshi_discount']/10));
                                }else{
                                    echo '¥'. $v['goods_store_price'];
                                }

                            } else {
                                echo '<a url="index.php?act=login" onClick="pclicked(this);">请登录</a>';
                            }?></li>
                        <li class="button-small button border-red-light radius-rounded float-right"><a url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$v['goods_id']), 'goods');?>" onClick="pclicked(this);">立即抢购</a></li>
                    </ul>
                </div>
                <?php }?></div>
            <div class="text-center bg-white margin-top padding-small" onclick="loadMore(this)" group="<?php echo PROMOTIONS_SPECIAL;?>" type="<?php echo $_GET['promotions_type_id'];?>" next-page="2">加载更多</div>
            <?php }else{?>
                <ul> <li class="noTxt">
                        <div class="text-center text-gray padding-large">
                            <i class="icon-meh-o"></i>
                            <p>暂无相关的数据记录。</p>
                        </div>
                    </li></ul>
            <?php }?></div>
            <!--特价推荐E-->

        </div>

    </div>